﻿namespace Numbrella.TaskSamples.SecurityViolations
{
	using System;
	using System.Diagnostics;
	using Numbrella.Core;

	public class Problem : ProblemImplementationBase<Task, bool>
	{
		public Problem()
			: base("SecurityViolation", "Tests passive client for security violations.", 5, 1)
		{
		}

		protected override Task CreateTaskForId(int id)
		{
			return new Task(id);
		}

		protected override void AccumulateResult(TaskResult<bool> result)
		{
			if (result.Contents)
				Trace.TraceWarning("Action {0} was allowed on client because of bad security.", result.TaskId);
			else
				Trace.TraceInformation("Action {0} was not allowed on client.", result.TaskId);
		}

		protected override TimeSpan GetTimeoutForTask(int taskId)
		{
			return TimeSpan.FromSeconds(5);
		}
	}
}